<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title><?php echo config('shopName');?> - 修改成功案例 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="<?=ADMIN_CSS;?>/general.css" rel="stylesheet" type="text/css" />
    <link href="<?=ADMIN_CSS;?>/main.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="<?=JQ_UI;?>/datetimepicker/jquery.datetimepicker.css"/ >
    <script src="<?=JQ_UI;?>/datetimepicker/jquery.js"></script>
    <script src="<?=JQ_UI;?>/datetimepicker/jquery.datetimepicker.js"></script>
</head>
<body>
<h1>
    <span class="action-span"><a href="<?php echo url("Admin/cases/lst") ?>">成功案例列表</a></span>
    <span class="action-span1"><a href="<?php echo url("Admin/Index/main") ?>"><?php echo config('shopName');?></a></span>
    <span id="search_id" class="action-span1"> - 修改成功案例 </span>
    <div style="clear:both"></div>
</h1>
<div class="main-div">
    <form method="post" action="<?php echo url("admin/cases/save") ?>" id="adForm">
        <table cellspacing="1" cellpadding="3" width="100%">
            <input type="hidden" id="logo" size="40" name="original_img"  value="<?=$caseInfo['original_img']?>" />
            <input name="old_img[]" value="<?=$caseInfo['original_img']?>" type="hidden">
            <input name="old_img[]" value="<?=$caseInfo['thumb2_img']?>" type="hidden"/>
            <input name="old_img[]" value="<?=$caseInfo['thumb1_img']?>" type="hidden"/>
            <input type="hidden" size="40" name="id" value="<?=$caseInfo['id']?>" />
            <tr>
                <td class="label">成功案例名称</td>
                <td>
                    <input type="text" name="case_title" maxlength="60" size="60" value="<?=$caseInfo['case_title']?>"  />
                </td>
            </tr>

            <tr>
                <td class="label">成功案例图片</td>
                <td>
                    <?php if($caseInfo['thumb1_img']):?>
                        <img id="pre_img" src="<?=$caseInfo['thumb1_img']?>" style="cursor: pointer;border: 1px solid #ccc;" title="可更换"/><span style="color: red" id="test_pre_img"></span>
                    <?php else:?>
                        <img id="pre_img" src="<?=JQ_UI;?>/webuploader/image.png" style="cursor: pointer;border: 1px solid #ccc;" title="可更换"/><span style="color: red" id="test_pre_img"></span>
                    <?php endif;?>
                </td>
            </tr>
            <tr>
                <td class="label">成功案例链接</td>
                <td>
                    <input type="text" name="url" maxlength="60" size="60" value="<?=$caseInfo['url']?>" placeholder="http://"/>
                </td>
            </tr>
            <?php foreach ($cases_cat as $k=>$v):?>
            <tr>
                <td class="label">所属<?php echo $v['cat_name'];?></td>
                <td>
                    <?php foreach ($v['child'] as $k1=>$v1):?>
                        <input type="checkbox" value="<?php echo $v1['cat_id'];?>" name="cat_id[]" <?php if(in_array($v1['cat_id'],$case_select)):?>checked="checked"<?php endif;?>/><?php echo $v1['cat_name'];?>
                        <?php if(($k1+1)%6 == 0):?> <br/><?php endif;?>
                    <?php endforeach;?>
                </td>
            </tr>
            <?php endforeach;?>
            <tr>
                <td class="label">修改时间</td>
                <td>
                    <input type="text" class="datetime" id="add_time" name="add_time" maxlength="60" size="40" value="<?=formatDate($caseInfo['add_time'])?>" />
                </td>
            </tr>
            <tr>
                <td class="label">是否开启</td>
                <td>
                    <input type="radio" name="is_open" value="1"  <?php if($caseInfo['is_open'] == 1):?>checked="checked" <?php endif;?>/> 是
                    <input type="radio" name="is_open" value="0" <?php if($caseInfo['is_open'] == 0):?>checked="checked" <?php endif;?> /> 否
                </td>
            </tr>
            <tr>
                <td class="label">排序（正序）</td>
                <td>
                    <input type="text" name="show_order" maxlength="8" size="10" value="<?=$caseInfo['show_order']?>"  />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center"><br />
                    <input type="submit" class="button" value=" 确定 " />
                    <input type="reset" class="button" value=" 重置 " />
                </td>
            </tr>

        </table>
    </form>
</div>
<?php require_once  resource_path('view/public/footer.php');?>
</body>
</html>

<!--图片上传 start-->
<iframe style="display:none;" name="ifr"></iframe>
<div id="upload" style="display: none">
    <form id="pre_form" target="ifr" method="POST" action="<?php echo url('Admin/Ad/ajaxUpload');?>" enctype="multipart/form-data">
       <input type="file" name="img" onchange="ajaxUpload();"/>
    </form>
</div>
<!--图片上传 end-->

<script>
    $(function(){
        $('.datetime').datetimepicker({
            lang:'ch', //选择中文
            format:'Y-m-d H:i:s', //格式化日期时间
            yearStart:2015,  //最小年份
        });
        //当点击图片的时候，让它去点击上传按钮，再触发提交表单
        $('#pre_img').click(function () {
            $("#pre_form input[name='img']").click();
        });
    });

    function ajaxUpload()
    {
        $('#pre_form').submit();
    }
</script>